<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>P131demo02</title>
</head>
<body>
        <input type="button" value="打开窗口" onclick="openWin()">
        <input type="button" value="调整窗口位置和大小" onclick="changeWin()">
        <script>
          var myWindow;
          function openWin() {
            myWindow = window.open('', 'newWin', 'width=250,height=300');
            getPosSize();                  
          }
          function changeWin() {
            myWindow.moveBy(250, 250);      
            myWindow.focus();               
            myWindow.resizeTo(500, 350);    
            getPosSize();                   
          }
          function getPosSize() {
            var x = myWindow.screenLeft, y = myWindow.screenTop;
            var inH = myWindow.innerHeight, inW = myWindow.innerWidth;
            var outH = myWindow.outerHeight, outW = myWindow.outerWidth;
            myWindow.document.write('<p>相对屏幕窗口的坐标：(' + x + ',' + y + ')</p>');
            myWindow.document.write('<p>文档的高度和宽度：' + inH + ',' + inW + '</p>');
            myWindow.document.write('<p>窗口的高度和宽度：' + outH + ',' + outW + '</p><hr>');
          }
        </script>
    <p><a href="第六章.html">返回上一级</a></p>
</body>
</html>